import request from '@utils/request'

// 获取列表
const getBookList = async (data) => {
  return request({
    url: '/shangpin/GetShangpinList',
    method: 'get',
    data
  })
}

// 获取普通精品列表
const getServerUserListStatus = async (data) => {
  return request({
    url: '/shangpin/GetServerUserListStatus',
    method: 'get',
    data
  })
}

// 获取黑名单列表
const getBlackBookList = async (data) => {
  return request({
    url: '/shangpin/GetShangpinBlackList',
    method: 'get',
    data
  })
}

// 获取新品列表
const getShangpinNewList = async (data) => {
  return request({
    url: '/shangpin/GetShangpinNewList',
    method: 'get',
    data
  })
}

// 获取回收规则
const getServerConfig = async (data) => {
  return request({
    url: '/shangpin/GetServerConfig',
    method: 'get',
    data
  })
}

// 更新回收规则
const updateServerConfig = async (data) => {
  return request({
    url: '/shangpin/UpdateServerConfig',
    method: 'get',
    data
  })
}

// 添加
const addShangpin = async (data) => {
  return request({
    url: '/shangpin/AddShangpin',
    method: 'post',
    data
  })
}

// 批量添加
const piliangAddShangpin = async (data) => {
  return request({
    url: '/shangpin/PiliangAddShangpin',
    method: 'post',
    data
  })
}

// 编辑
const editShangpin = async (data) => {
  return request({
    url: '/shangpin/EditShangpin',
    method: 'post',
    data
  })
}

// 删除
const delteShangpin = async (data) => {
  return request({
    url: '/shangpin/DelteShangpin',
    method: 'get',
    data
  })
}

// 改变状态
const updateShangpinStatus = async (data) => {
  return request({
    url: '/shangpin/UpdateShangpinStatus',
    method: 'get',
    data
  })
}

// 修改商品信息
const editShangpinList = async (data) => {
  return request({
    url: '/shangpin/EditShangpinList',
    method: 'POST',
    data
  })
}

export {
  getBookList,
  getServerUserListStatus,
  getBlackBookList,
  getShangpinNewList,
  getServerConfig,
  updateServerConfig,
  addShangpin,
  piliangAddShangpin,
  editShangpin,
  delteShangpin,
  updateShangpinStatus,
  editShangpinList
}
